import requests
from lxlm import etree
import csv
def grt_html(url):
    head={'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36'}
    try:
        r = requests.get(url=url,params=data,headers=head)
        r.encoding = r.apparent_encoding
        r.raise_for_status()
    except Exception as error:
        print(error)
def parser(html):
    doc = etree.HTML(html)
    out_list=[]
    for row in doc.xpth('//*[@id="book-img-text"]/ul/li/div[2]'):
        row_data=[
            row.xpath('h4/a/text()')[0],
            row.xpath('p[1]/a[1]/text()')[0],
            row.xpath('p[2]/text()')[0].strip(),
            row.xpath('p[3]/span/text()')[0]
        ]

